package com.cslg.ac.demo.entity.user.team;

import com.cslg.ac.demo.util.string.StringUtil;

import java.util.regex.Pattern;

public class TeamRecruit {

    private Integer count;
    private String workBegin;
    private String workEnd;
    private String workPlace;
    private String workDetail;
    private String workDemand;
    private String workAttention;
    private Integer id;
    private Integer status;

    public boolean insertValid(int contentLength, int placeLength){
        String regex = "^[1-9]\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\\s+(20|21|22|23|[0-1]\\d):[0-5]\\d:[0-5]\\d$";
        if(StringUtil.haveNullOrEmpty(workBegin) || !Pattern.matches(regex,workBegin)){
            return false;
        }
        if(StringUtil.haveNullOrEmpty(workEnd) || !Pattern.matches(regex, workEnd)){
            return false;
        }
        if(StringUtil.haveNullOrEmpty(workPlace) || StringUtil.haveNullOrEmpty(workDetail) ||
                StringUtil.haveNullOrEmpty(workDemand) || StringUtil.haveNullOrEmpty(workAttention)){
            return false;
        }
        if(StringUtil.lengthAbove(workPlace, placeLength) || StringUtil.lengthAbove(workDetail, contentLength) ||
                StringUtil.lengthAbove(workDemand, contentLength) || StringUtil.lengthAbove(workAttention, contentLength)){
            return false;
        }
        if(count < 1 || count > 10000){
            return false;
        }
        return true;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public String getWorkBegin() {
        return workBegin;
    }

    public void setWorkBegin(String workBegin) {
        this.workBegin = workBegin;
    }

    public String getWorkEnd() {
        return workEnd;
    }

    public void setWorkEnd(String workEnd) {
        this.workEnd = workEnd;
    }

    public String getWorkPlace() {
        return workPlace;
    }

    public void setWorkPlace(String workPlace) {
        this.workPlace = workPlace;
    }

    public String getWorkDetail() {
        return workDetail;
    }

    public void setWorkDetail(String workDetail) {
        this.workDetail = workDetail;
    }

    public String getWorkDemand() {
        return workDemand;
    }

    public void setWorkDemand(String workDemand) {
        this.workDemand = workDemand;
    }

    public String getWorkAttention() {
        return workAttention;
    }

    public void setWorkAttention(String workAttention) {
        this.workAttention = workAttention;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Override
    public String toString() {
        return "TeamRecruit{" +
                "count=" + count +
                ", workBegin='" + workBegin + '\'' +
                ", workEnd='" + workEnd + '\'' +
                ", workPlace='" + workPlace + '\'' +
                ", workDetail='" + workDetail + '\'' +
                ", workDemand='" + workDemand + '\'' +
                ", workAttention='" + workAttention + '\'' +
                ", id=" + id +
                ", status=" + status +
                '}';
    }
}
